From 9771a61cecc1c5245b149f7fd90b6e6626b2ab3b Mon Sep 17 00:00:00 2001 From: oliskoli Date: Sat, 6 Sep 2008 16:53:16 +0000 Subject: [PATCH] mapasia: Rename module tr7 as mapasia. --- Makefile.in | 4 ++-- tr7.c => mapasia.c | 40 ++++++++++++++++++++++++++++------------ vecs.c | 10 +++++----- 3 files changed, 35 insertions(+), 19 deletions(-) rename tr7.c => mapasia.c (79%) diff --git a/Makefile.in b/Makefile.in index 4e5c4abd3..1e884f159 100644 --- a/Makefile.in +++ b/Makefile.in @@ -59,7 +59,7 @@ ALL_FMTS=$(MINIMAL_FMTS) gtm.o gpsutil.o pcx.o cetus.o copilot.o \ wbt-200.o stmsdf.o gtrnctr.o dmtlog.o raymarine.o alan.o vitovtt.o \ ggv_log.o g7towin.o garmin_gpi.o lmx.o random.o xol.o dg-100.o \ navilink.o mtk_logger.o ik3d.o osm.o destinator.o exif.o vidaone.o \ - igo8.o gopal.o humminbird.o tr7.o gnav_trl.o navitel.o ggv_ovl.o + igo8.o gopal.o humminbird.o mapasia.o gnav_trl.o navitel.o ggv_ovl.o FMTS=@FMTS@ @@ -756,7 +756,7 @@ tpo.o: tpo.c defs.h config.h queue.h gbtypes.h zlib/zlib.h zlib/zconf.h \ jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \ jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsmem.h \ jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h -tr7.o: tr7.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \ +mapasia.o: mapasia.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \ zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h csv_util.h trackfilter.o: trackfilter.c defs.h config.h queue.h gbtypes.h \ zlib/zlib.h zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h \ diff --git a/tr7.c b/mapasia.c similarity index 79% rename from tr7.c rename to mapasia.c index ab3023a9c..e42d5fba6 100644 --- a/tr7.c +++ b/mapasia.c @@ -37,6 +37,12 @@ #define TR7_S_HOUR 8 #define TR7_S_MIN 10 #define TR7_S_SEC 12 +#define TR7_S_LON 16 +#define TR7_S_LAT 20 +#define TR7_S_SPEED 24 +#define TR7_S_COURSE 26 +#define TR7_S_VALID 28 +#define TR7_S_FIX 29 static arglist_t tr7_args[] = { @@ -83,8 +89,8 @@ tr7_read(void) memset(&tm, 0, sizeof(tm)); - lat = (double)le_read32(&buff[20]) / 1000000.0; - lon = (double)le_read32(&buff[16]) / 1000000.0; + lat = (double)le_read32(&buff[TR7_S_LAT]) / 1000000.0; + lon = (double)le_read32(&buff[TR7_S_LON]) / 1000000.0; if ((fabs(lat) > 90) || (fabs(lon) > 180)) { trk = NULL; continue; @@ -103,24 +109,34 @@ tr7_read(void) wpt->latitude = lat; wpt->longitude = lon; wpt->creation_time = mkgmtime(&tm); - + WAYPT_SET(wpt, course, 360 - le_read16(&buff[TR7_S_COURSE])); + WAYPT_SET(wpt, speed, (double)le_read16(&buff[TR7_S_SPEED]) / 3.6); +#if 0 + /* unsure items */ + wpt->fix = buff[TR7_S_FIX]; + if (buff[TR7_S_VALID] != 'A') { + waypt_free(wpt); + continue; + } +#endif if (waypt_speed(prev, wpt) > 9999.9) { waypt_free(wpt); - } else { - if (! trk) { - trk = route_head_alloc(); - track_add_head(trk); - } - track_add_wpt(trk, wpt); - prev = wpt; + continue; + } + + if (! trk) { + trk = route_head_alloc(); + track_add_head(trk); } + track_add_wpt(trk, wpt); + prev = wpt; } } } /**************************************************************************/ -ff_vecs_t tr7_vecs = { /* currently we can only read tracks */ +ff_vecs_t mapasia_tr7_vecs = { /* currently we can only read tracks */ ff_type_file, { ff_cap_none /* waypoints */, @@ -135,7 +151,7 @@ ff_vecs_t tr7_vecs = { /* currently we can only read tracks */ NULL, NULL, tr7_args, - CET_CHARSET_ASCII, 1 /* FIXED - CET-REVIEW - */ + CET_CHARSET_UTF8, 1 /* FIXED - CET-REVIEW - */ }; diff --git a/vecs.c b/vecs.c index 61e552db9..9ce270d06 100644 --- a/vecs.c +++ b/vecs.c @@ -143,7 +143,7 @@ extern ff_vecs_t vidaone_vecs; extern ff_vecs_t gopal_vecs; extern ff_vecs_t humminbird_vecs; extern ff_vecs_t humminbird_ht_vecs; -extern ff_vecs_t tr7_vecs; +extern ff_vecs_t mapasia_tr7_vecs; extern ff_vecs_t gnav_trl_vecs; extern ff_vecs_t navitel_trk_vecs; extern ff_vecs_t ggv_ovl_vecs; @@ -821,8 +821,8 @@ vecs_t vec_list[] = { "ht" }, { - &tr7_vecs, - "tr7", + &mapasia_tr7_vecs, + "mapasia_tr7", "MapAsia track file (.tr7)", "tr7" }, @@ -835,13 +835,13 @@ vecs_t vec_list[] = { { &navitel_trk_vecs, "navitel_trk", - "Navitel binary tracks (.bin)", + "Navitel binary track (.bin)", "bin" }, { &ggv_ovl_vecs, "ggv_ovl", - "Geogrid-Viewer ascii overlay files (.ovl)", + "Geogrid-Viewer ascii overlay file (.ovl)", "ovl" }, -- 2.30.2